package algorithm.poj.p3000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.util.StringTokenizer;


/**
 * 分析：
 * X = K/p
 * Y = K(K+1)/p - K/p^2
 * 
 * 实现：
 * 经验：
 * 教训：
 * 分类：数学
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P3682 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P3682.class.getResource("P3682.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		DecimalFormat fmt = new DecimalFormat("###.000");
		StringBuffer sb = new StringBuffer("");
		String line = stdin.readLine();
		while (line != null && !"0".equals(line.trim())) {
			StringTokenizer st = new StringTokenizer(line);
			int K = Integer.valueOf(st.nextToken());
			double p = Double.valueOf(st.nextToken());
			sb.append(fmt.format(K/p));
			sb.append(" ");
			sb.append(fmt.format((K*(K+1)/p/p - K/p)));
			sb.append("\n");
			line = stdin.readLine();
		}
		System.out.println(sb);
	}
}